package com.gem.mapper;

import com.gem.domain.Campus;
import com.gem.domain.CampusConn;
import com.gem.domain.CampusInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author: 玲
 * @Description: 我的院校接口
 * @create 2019-10-15 20:58
 * @Modified By:
 */
@Mapper
public interface CampusMapper {

    //保存院校
    Integer save(Campus campus);

    //查询所有院校
    @Select("select c.* ,u.personname from campus c,user u where c.market_employee_id = u.uid and c.campus_status > 0")
    List<Campus> findAll();

    //根据id查询院校
    @Select("select * from campus where campus_id = #{campusId} and campus_status > 0")
    Campus findById(Integer campusId);

    //根据id伪删除
    @Update("update campus set campus_status = -1 where campus_id = #{campusId}")
    Integer deleteById(Integer campusId);

    //更新院校信息
    Integer update(Campus campus);

    //搜索院校
    List<Campus> search(Campus campus);

    //根据id查询院校详情
    @Select("select * from campusInfo where campus_id = #{campusId} and campusInfo_status > 0")
    CampusInfo findInfo(Integer campusId);

    //更新院校详情
    Integer updateInfo(CampusInfo info);

    //保存院校详情
    Integer saveInfo(CampusInfo info);

    //伪删除院校详情
    @Update("update campusInfo set campusInfo_status = -1 where campusInfo_id = #{campusInfoId}")
    Integer deleteInfo(Integer campusInfoId);

    //查询所有院校详情
    @Select("select * from campusInfo where campusInfo_status > 0")
    List<CampusInfo> findAllInfo();

    //伪删除所选院校
    Integer deleteAll(int[] campusIds);

    //echarts

    //获取所有渠道专员的id
    @Select("select distinct market_employee_id from campus ")
    List<Integer> getAllSellers();

    //获取每个渠道专员下的院校id
    @Select("select campus_id from campus where market_employee_id=#{marketEmployeeId}")
    List<Integer> getCampusIds(Integer marketEmployeeId);





}
